﻿//using System.Drawing;
//using DevExpress.XtraEditors;
//using DevExpress.XtraEditors.ViewInfo;

//namespace Extensions
//{
//    public static class PictureEditExtensions
//    {
//        private static bool CommonSetup(PictureEdit pictureEdit, ref DevExpress.XtraEditors.HScrollBar hScrollBar, ref DevExpress.XtraEditors.VScrollBar vScrollBar, ref PictureEditViewInfo viewInfo)
//        {
//            if (pictureEdit.Image == null || pictureEdit.Controls.Count < 2)
//                return false;

//            hScrollBar = pictureEdit.Controls[1] as DevExpress.XtraEditors.HScrollBar;
//            vScrollBar = pictureEdit.Controls[0] as DevExpress.XtraEditors.VScrollBar;
//            viewInfo = pictureEdit.GetViewInfo() as PictureEditViewInfo;

//            return hScrollBar != null && vScrollBar != null && viewInfo != null;
//        }


//        private static int ScreenToImage(int screenCoord, int pictureStart, ScrollBarBase scrollBar, int zoomPercent)
//        {
//            return (screenCoord + (scrollBar.Visible ? scrollBar.Value : -pictureStart)) * 100 / zoomPercent;
//        }

//        private static int ImageToScreen(int imageCoord, int pictureStart, ScrollBarBase scrollBar, int zoomPercent)
//        {
//            return imageCoord * zoomPercent / 100 - (scrollBar.Visible ? scrollBar.Value : -pictureStart);
//        }
//    }
//}